import 'dart:ffi'; // For FFI
import 'dart:io'; // For Platform.isX
import 'package:ffi/ffi.dart';
export 'dart:ffi'; // For FFI
export 'dart:io'; // For Platform.isX
export 'package:ffi/ffi.dart';
export 'base_types.dart';
// NOTE wujehy 动态库的搜索
final DynamicLibrary nativeLib = Platform.isAndroid ? DynamicLibrary.open("libflutter_cpp_sdk.so") : DynamicLibrary.process();
typedef CodeMsgCallbackFunction = void Function(int code, Pointer<Utf8> msg);

// 回调函数 / 常用符号签名
typedef IntCallback = Void Function(Int32);
typedef CodeMsgCallback = Void Function(Int32, Pointer<Utf8>);
typedef Void_Function_Int64_String_func = Void Function(Int64, Pointer<Utf8>);
typedef Void_Function_Int64_String_Function = void Function(int, Pointer<Utf8>);
typedef Void_Function_Int64_Int32_func = Void Function(Int64, Int32);
typedef Void_Function_Int64_Int64_func = Void Function(Int64, Int64);
typedef Void_Function_Int64_Int32_String_func = Void Function(Int64, Int32 ,Pointer<Utf8>);
typedef Void_Function_Int64_Int32_String_Function = void Function(int, int ,Pointer<Utf8>);

typedef Void_Function_Int64_Int_Function = void Function(int, int);
typedef Void_Function_NULL_func = Void Function();
typedef Void_Function_NULL_Function = void Function();
typedef Void_Function_Int64_func = Void Function(Int64);
typedef Void_Function_Int64_Function = void Function(int);

typedef Void_Function_Void_func = Void Function();
typedef Void_Function_Void_Function = void Function();

typedef Void_Function_Int64_String_String_String_Int32_func = Void Function(Int64, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Int32);
typedef Void_Function_Int64_String_String_String_Int32_Function = void Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, int);

typedef Void_Function_Int64_String_String_String_func = Void Function(Int64, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef Void_Function_Int64_String_String_String_Function = void Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);

typedef Void_Function_Int64_String_String_String_String_func = Void Function(Int64, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef Void_Function_Int64_String_String_String_String_Function = void Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);

typedef Void_Function_Int64_String_String_func = Void Function(Int64, Pointer<Utf8>, Pointer<Utf8>);
typedef Void_Function_Int64_String_String_Function = void Function(int, Pointer<Utf8>, Pointer<Utf8>);

typedef Void_Function_Int64_String_Int32_Int32_func = Void Function(Int64, Pointer<Utf8>, Int32, Int32);
typedef Void_Function_Int64_String_Int32_Int32_Function = void Function(int, Pointer<Utf8>, int, int);

typedef Void_Function_Int64_String_Int32_func = Void Function(Int64, Pointer<Utf8>, Int32);
typedef Void_Function_Int64_String_Int64_func = Void Function(Int64, Pointer<Utf8>, Int64);
typedef Void_Function_Int64_String_Int_Function = void Function(int, Pointer<Utf8>, int);
typedef Void_Function_Int64_String_String_Int32_func = Void Function(Int64, Pointer<Utf8>,Pointer<Utf8> , Int32);
typedef Void_Function_Int64_String_String_Int64_func = Void Function(Int64, Pointer<Utf8>,Pointer<Utf8> , Int64);
typedef Void_Function_Int64_String_String_Int_Function = void Function(int, Pointer<Utf8>,Pointer<Utf8> , int);

typedef Void_Function_Int32_func = Void Function(Int32);
typedef Void_Function_Int32_Function = void Function(int);

// int
typedef Int32_Function_NULL_func = Int32 Function();
typedef Int64_Function_NULL_func = Int64 Function();
typedef Int_Function_NULL_Function = int Function();

typedef Int32_Function_String_String_String_func = Int32 Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef Int64_Function_String_String_String_func = Int64 Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef Int_Function_String_String_String_Function = int Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);

typedef Int32_Function_Int32_String_func = Int32 Function(Int32, Pointer<Utf8>);
typedef Int64_Function_Int32_String_func = Int64 Function(Int32, Pointer<Utf8>);
typedef Int_Function_Int32_String_Function = int Function(int, Pointer<Utf8>);

typedef Int32_Function_Int32_func = Int32 Function(Int32);
typedef Int64_Function_Int32_func = Int64 Function(Int32);
typedef Int_Function_Int32_Function = int Function(int);

typedef Int32_Function_String_func = Int32 Function(Pointer<Utf8>);
typedef Int64_Function_String_func = Int64 Function(Pointer<Utf8>);
typedef Int_Function_String_Function = int Function(Pointer<Utf8>);

// void foo(char)
typedef Void_Function_String_func = Void Function(Pointer<Utf8>);
typedef Void_Function_String_Function = void Function(Pointer<Utf8>);


